#include <stdio.h>

class Animal {
protected:
    int height = -1;
    int weight = -2;
public:
    //Animal() = default;
    Animal(int height) :height(height){
        height++;
    }
    Animal(int height, int weight) {
        this->height = height;
        this->weight = weight;
        height++;
        weight++;
        
    }
    void show(void) {
        printf("height: %d, weight: %d\n", height, weight);
    }
    
};
class Fish:public Animal {
public:
    //显示调用父类的构造函数
    Fish(): Animal(height, weight) { 
        //这里height, weight为无效绑定
        //如果不显式调用Amimal, 则会自动调用Animal的无参构造函数, 如果Animal没有
        //定义无参构造函数则会报错
    }
    Fish(int height) :Animal(height) {
    } 
    Fish(int height, int weight): Animal(height, weight) {
    }
    void fshow() {
        Fish::show(); //这里向上匹配到Animal::show
    }
};

int main(void) {
    typedef void F();
    Fish f1, f2(10), f3(3, 2);
    F Fish::*showp = &Fish::show;
    f1.show(); f2.show(); f3.show();
    f1.fshow();
    (f1.*showp)();
    return 0;
}
